﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Project.ascx.cs" Inherits="CtrlProject" %>
<table style="width: 100%;">
    <tr>
        <td colspan='2'>
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowSummary="true" />
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <div class="section">
                <h4 class="header">
                    General Information</h4>
                <table style="width: 100%;">
                    <tr>
                        <td style="width: 150px;">
                            Name:
                        </td>
                        <td>
                            <asp:TextBox ID="m_ctrlName" runat="server" Text="<%# this.ProjectManager.Project.Name %>"
                                Width="100%" Enabled="<%# Editable %>" />
                            <asp:RequiredFieldValidator ControlToValidate="m_ctrlName" runat="server" Display="Static"  EnableClientScript="true" ErrorMessage="Name must have value">
                            </asp:RequiredFieldValidator>
                            <asp:CustomValidator runat="server" ControlToValidate="m_ctrlName" EnableClientScript="false" ErrorMessage="Name must be unique" OnServerValidate="m_ctrlName_Validate">
                            </asp:CustomValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Description:
                        </td>
                        <td>
                            <asp:TextBox ID="m_ctrlDescription" runat="server" Text="<%# this.ProjectManager.Project.Description %>"
                                Width="100%" Enabled="<%# Editable %>"  />
                            <asp:RequiredFieldValidator ControlToValidate="m_ctrlDescription" runat="server" Display="Static"  EnableClientScript="true" ErrorMessage="Description must have falue"> 
                            </asp:RequiredFieldValidator>
                        </td>
                    </tr>
                </table>
            </div>
        </td>
    </tr>
    <tr>
        <td style="width: 50%; vertical-align: top;">
            <div class="section">
                <h4 class="header">
                    Factors</h4>
                <table style="width: 100%;">
                    <asp:Repeater ID="m_rptFactorsCategories" runat="server" DataSource="<%# this.ProjectManager.FactorsCategories %>">
                        <ItemTemplate>
                            <tr>
                                <td colspan="2">
                                    <span style="font-size: 13px; font-weight: bold;">
                                        <asp:Literal ID="m_lblFactorName" runat="server" Text='<%# Eval("Name") %>' />:
                                    </span>
                                </td>
                            </tr>
                            <asp:Repeater ID="m_Repeater" runat="server" DataSource='<%# Eval("Factors") %>'>
                                <ItemTemplate>
                                    <tr>
                                        <td style="width: 50%;">
                                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("Name") %>' />:
                                        </td>
                                        <td style="width: 50%;">
                                            <asp:HiddenField ID="m_hfFactorID" runat="server" Value='<%# Eval("FactorID") %>' />
                                            <asp:DropDownList ID="m_ddlFactorScale" runat="server" AppendDataBoundItems="true"
                                                OnDataBound="FactorsScale_DataBound" OnSelectedIndexChanged="FactorsScale_IndexChanged"
                                                Width="100%" DataSource='<%# ((ICollection<ProjectStorageDB.FactorScale>)Eval("FactorScales")).OrderBy(fc=> fc.Order) %>' 
                                                DataTextField="Value" DataValueField="FactorScaleID" Enabled="<%# Editable %>" >
                                                <asp:ListItem Value="" Text="None" Selected="true" />
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
            </div>
        </td>
        <td style="width: 50%; vertical-align: top;">
            <div class="section">
                <h4 class="header">
                    Practices</h4>
                    <br />
                    <div style="margin-left:30%;">
                        <asp:Label ID="Label2" runat="server" Font-Bold="true" Text="None"/>  &nbsp;
                        <asp:Repeater ID="m_rptPracticeValues" runat="server" DataSource="<%# Enum.GetValues(typeof(ProjectStorageDB.Objects.EnumPracticeUsingValue)) %>">
                            <ItemTemplate>
                                <asp:Label runat="server" Font-Bold="true" Text='<%# Container.DataItem %>'/> &nbsp;
                            </ItemTemplate>
                        </asp:Repeater>
                    </div>
                  <table style="width: 100%;">
                    <asp:Repeater ID="m_rptAgileMethods" runat="server" DataSource="<%# this.ProjectManager.AgileMethods %>">
                        <ItemTemplate>
                            <tr>
                                <td colspan="2">
                                    <span style="font-size: 13px; font-weight: bold;">
                                        <asp:Literal ID="m_lblAgileMethodName" runat="server" Text='<%# Eval("Name") %>' />:
                                    </span>
                                </td>
                            </tr>
                            <asp:Repeater ID="m_rptAgilePractices" runat="server" DataSource='<%# Eval("AgilePractices") %>'>
                                <ItemTemplate>
                                    <tr>
                                        <td style="width: 50%;">
                                            <asp:Label ID="m_lblPracticeName" runat="server" Text='<%# Eval("Name") %>' />
                                            <div class="description">
                                                <asp:Label ID="m_lblPracticeDescription" runat="server" Text='<%# "(" + Eval("Description") + ")" %>' Visible='<%# Eval("Description")!=null %>' />
                                            </div>
                                        </td>
                                        <td style="width: 50%;">
                                            <asp:HiddenField ID="m_hfPracticeID" runat="server" Value='<%#  Eval("PracticeID") %>' />
                                            <%--<asp:DropDownList ID="m_ddlPracticeRelation" runat="server" AppendDataBoundItems="true"
                                                OnDataBound="PracticeRelation_DataBound" OnSelectedIndexChanged="PracticeRelation_IndexChanged"
                                                Width="100%" DataSource='<%# Enum.GetValues(typeof(ProjectStorageDB.Objects.EnumPracticeUsingValue)) %>'
                                                Enabled="<%# Editable %>" >
                                                <asp:ListItem Value="" Text="None" Selected="true" />
                                            </asp:DropDownList>--%>
                                            <asp:RadioButtonList ID="m_rblPracticeRelation" runat="server" AppendDataBoundItems="true" RepeatDirection="Horizontal" 
                                                    DataSource='<%# Enum.GetValues(typeof(ProjectStorageDB.Objects.EnumPracticeUsingValue)) %>'
                                                    Enabled="<%# Editable %>" OnDataBound="PracticeRelation_DataBound" OnSelectedIndexChanged="PracticeRelation_IndexChanged">
                                                    <asp:ListItem Value="" Selected="true" />
                                             </asp:RadioButtonList>                                                                                          
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
            </div>
            <div class="clr">
                &nbsp;</div>
        </td>
    </tr>
</table>
<asp:Button ID="m_btnSave" runat="server" CssClass="formButton" OnClick="Save_Click" Text="Save" Visible="<%# Editable %>" CausesValidation="true" />
<asp:Button ID="m_btnCancel" runat="server" CssClass="formButton" OnClick="Cancel_Click" Text="Cancel" />